<template>
	<view class="page">
		<view class="body">
			<Sub-title :label="detail.title" size="36rpx" />
			<view class="left">
				<view class="botl">
					<u-text :text="detail.createtime" size="24rpx" color="#BABABA" margin="0 14rpx 0 0" />
					<view class="" style="display: flex;font-size: 23rpx;" v-if="type!=2">
						<u-icon name="eye" size="mini"></u-icon>
						<u-text :text="`${detail.read||0}人`" size="23rpx" color="#BABABA" margin="0 0 0 8rpx" />
					</view>
				</view>
			</view>
			<u-image v-if="detail.image" show-loading :src="$imageOss(detail.image)" width="100%" height="208px" @click="preImage" />
			<!-- <view class="" style="margin: 0 auto;text-align: center;">
				<video :src="baseUrl+detail.video" :poster="$imageOss(detail.image)" class="image"></video>
			</view> -->
			<u-parse :content="detail.content" />
		</view>
	</view>
</template>

<script>
	import {
		knowDetail,policyDetail
	} from "@/request/homeApi.js";
	import config from "@/request/baseUrl.js";
	import Foot from "@/components/footer/index";
	export default {
		components: {
			Foot
		},
		data() {
			return {
				baseUrl: config.baseUrl,
				id: '',
				detail: {},
				msg: '',
				dataList: [],
				page: 1,
				last_page: 1,
				status: "nomore",
				type: null
			};
		},
		onLoad(e) {
			this.type = e.type
			this.id = e.id
			this.getDetails(e.id);
		},
		onReachBottom() {
			let that = this
			if (that.page < that.last_page) {
				that.page = that.page + 1
				that.getDataList()
			}
		},
		methods: {
			// 获取详情
			getDetails(id) {
				if (this.type == 1) {
					wx.setNavigationBarTitle({
						title: '知识详情'
					})
					
					knowDetail({
						id
					}).then((res) => {
						if (res.code == 200) {
							this.detail = res.data;
						} else {
							uni.showToast({
								title: res.msg,
								duration: 1500,
								icon: 'none',
							})
						}
					});
				} else {
					wx.setNavigationBarTitle({
						title: '政策详情'
					})
					policyDetail({
						id
					}).then((res) => {
						if (res.code == 200) {
							this.detail = res.data;
						} else {
							uni.showToast({
								title: res.msg,
								duration: 1500,
								icon: 'none',
							})
						}
					});
				}
			},
		},
	};
</script>

<style lang="scss" scoped>
	.page {
		padding: 20rpx 30rpx;

		.left {
			display: flex;
			justify-content: space-between;
			padding: 20rpx 0;
			border-bottom: 2rpx solid #D9D9D9;
			margin-bottom: 10rpx;

			.botl {
				display: flex;
				width: 100%;
				text-align: right;
				align-items: center;
				justify-content: space-evenly;
			}
		}

		.bott {
			position: fixed;
			bottom: 0;
			left: 0;
			height: 110rpx;
			background: #fff;
			width: 100%;
			display: flex;
			align-items: center;
			padding: 30rpx 40rpx 40rpx;
			justify-content: space-between;
			box-shadow: 0 0 10rpx rgba(228, 228, 228, 0.5);
			box-sizing: border-box;
			z-index: 2;

			.button {
				width: 100%;
				height: 70rpx;
				padding: 0 28rpx;
				box-sizing: border-box;
				margin-left: 20rpx;
				text-align: center;
				line-height: 70rpx;
				color: #fff;
				font-size: 28rpx;
				background-color: #466EC5;
				border-radius: 10rpx;
			}
		}

		.remarkBox {
			width: 100%;
			box-sizing: border-box;
			font-size: 28rpx;
			color: #909090;

			.navItem {
				width: 98%;
				text-align: center;
				box-sizing: border-box;
				display: flex;
				align-items: center;
				margin: 20rpx auto;

				.image {
					width: 56rpx;
					height: 56rpx;
					border-radius: 50%;
					margin-right: 16rpx;
				}
			}
		}

		.bot {
			.bot-icon {
				color: #909090;
				display: flex;
				font-family: PingFang SC;
				font-size: 26rpx;
				font-style: normal;
				font-weight: 400;
				line-height: normal;
				justify-content: flex-end;

				.box {
					display: flex;
					align-items: center;
					margin-right: 20rpx;

					.col_icon {
						width: 24rpx !important;
						height: 24rpx !important;
						margin-right: 6rpx;
					}
				}
			}
		}
	}
</style>